<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue生命周期</title>
</head>
<body>
    <div id="app">{{content}}</div>
</body>
<script src="vue.js"></script>
<script>

    var vm = new Vue({
        el: '#app',
        template: '<h1>{{this.content}}</h1>',
        data: {
            content: 'hello world!'
        },
        beforeCreate: function() {
            console.log('beforeCreate', this.$data)
        },
        created() {
            console.log('created', this.$data)
            
        },
        beforeMount() {
            console.log('beforeMount', this.$el);
        },
        mounted() {
            console.log('mounted', this.$el);
        },
        // vm.$destroy()手动销毁
        beforeDestroy() {
            console.log('beforeDestroy', this.$el)
        },
        destroyed() {
            console.log('destroyed', this.$el)
        },
        beforeUpdate() {
            console.log('beforeUpdate', this.$el);
        },
        updated() {
            console.log('updated', this.$el);
        },
    })
</script>
</html>